package com.sg.service.base.app.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sg.common.util.CommonFunctionHelper;
import com.sg.dto.base.app.req.*;
import com.sg.entity.OmsBizAppBatch;
import com.sg.service.base.app.MOmsBizAppBatchService;
import com.wicket.okrapp.common.dto.FieldInfo;
import com.wicket.okrapp.common.exception.BizException;
import com.wicket.okrapp.dal.mapper.mbg.OmsBizAppBatchMapper;
import com.wicket.okrframework.common.annotations.BanAuto;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author ：
 * @version 1.0
 * @since 2022/1/19 15:39
 */
@Service
public class MOmsBizAppBatchServiceImpl
        extends ServiceImpl<OmsBizAppBatchMapper, OmsBizAppBatch>
        implements MOmsBizAppBatchService {

    @Autowired
    OmsBizAppBatchMapper omsBizAppBatchMapper;

    /**
     * 3-13-01新增业务应用批次[2348]
     * gen by moon at 9/17/2022, 10:59:43 PM
     */
    @Trace(operationName = "3-13-01新增业务应用批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @BanAuto
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String addBizAppBatch(OmsBizAppBatch omsBizAppBatch) {
        omsBizAppBatch.setBatchId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsBizAppBatch.setBatchCode("B" + CommonFunctionHelper.getUid());//AUTO_GENERATE
        omsBizAppBatch.setBatchNumber(CommonFunctionHelper.getUid());//AUTO_GENERATE
        omsBizAppBatch.setIsNewbatch("TRUE");
        omsBizAppBatch.setSubjectLifeCycle("EDITING");
        omsBizAppBatch.setIsArchive("FALSE");
        omsBizAppBatch.setIsEditing("TRUE");
        omsBizAppBatch.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsBizAppBatch.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsBizAppBatch.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsBizAppBatch.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsBizAppBatch.setIsValid("FALSE");
        omsBizAppBatch.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsBizAppBatch.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsBizAppBatch)) {
            return omsBizAppBatch.getBatchId();
        } else {
            return "-1";
        }

    }

    /**
     * 3-13-01查业务应用批次详情[2668]
     * gen by moon at 3/30/2023, 12:39:08 PM
     */
    @Trace(operationName = "3-13-01查业务应用批次详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsBizAppBatch queryBizAppBatchDetail(QueryBizAppBatchDetailReq reqDto) {

        try {
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            QueryWrapper<OmsBizAppBatch> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsBizAppBatch> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsBizAppBatch retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-13-01批量增业务应用批次[2667]
     * gen by moon at 10/15/2022, 10:03:12 PM
     */
    @Trace(operationName = "3-13-01批量增业务应用批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchAddBizAppBatch(List<OmsBizAppBatch> omsBizAppBatch) {

        if (omsBizAppBatch == null || omsBizAppBatch.size() == 0) {
            return false;
        }

        return super.saveBatch(omsBizAppBatch.stream().map(item -> {
            item.setBatchId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
            item.setBatchNumber(CommonFunctionHelper.getUid());//AUTO_GENERATE
            item.setBatchEndTime(CommonFunctionHelper.getFutureTime());//FUTURE_CURRENT_TIME
            item.setSubjectLifeCycle("EDITING");
            item.setIsArchive("FALSE");
            item.setIsEditing("TRUE");
            item.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
            item.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
            item.setIsValid("FALSE");
            item.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            item.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            return item;
        }).collect(Collectors.toList()));
    }

    /**
     * 3-13-01查业务应用批次列表[2955]
     * gen by moon at 10/15/2022, 10:03:16 PM
     */
    @Trace(operationName = "3-13-01查业务应用批次列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsBizAppBatch> queryBizAppBatchList(QueryBizAppBatchListReq reqDto) {

        try {
            QueryWrapper<OmsBizAppBatch> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID

            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsBizAppBatch.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsBizAppBatch.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsBizAppBatch.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsBizAppBatch>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-13-01修改业务应用批次[3604]
     * gen by moon at 10/15/2022, 10:03:18 PM
     */
    @Trace(operationName = "3-13-01修改业务应用批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateBizAppBatch(OmsBizAppBatch omsBizAppBatch) {

        return super.updateById(omsBizAppBatch);
    }

    /**
     * 3-13-01删除业务应用批次[3605]
     * gen by moon at 10/15/2022, 10:03:20 PM
     */
    @Trace(operationName = "3-13-01删除业务应用批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean deleteBizAppBatch(String batchId) {

        return super.removeById(batchId);
    }

    /**
     * 3-13-01批量查询业务应用批次[3899]
     * gen by moon at 10/15/2022, 10:03:22 PM
     */
    @Trace(operationName = "3-13-01批量查询业务应用批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsBizAppBatch> batchQueryBizAppBatch(BatchQueryBizAppBatchReq reqDto) {

        try {
            QueryWrapper<OmsBizAppBatch> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            reqDto.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
            reqDto.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
            if (reqDto.getBizAppBatchList() == null || reqDto.getBizAppBatchList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("ascription_object_id", reqDto.getBizAppBatchList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsBizAppBatch.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsBizAppBatch.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsBizAppBatch.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsBizAppBatch>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * 3-13-01批量删业务应用批次[3907]
     * gen by moon at 10/15/2022, 10:03:23 PM
     */
    @Trace(operationName = "3-13-01批量删业务应用批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchDeleteBizAppBatch(List<String> reqDto) {
        return false; //todo ruizhe dong
    }

    /**
     * 3-13-01构造单条批次验证数据[4240]
     * gen by moon at 9/13/2022, 12:34:41 AM
     */
    @Trace(operationName = "3-13-01构造单条批次验证数据")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @BanAuto
    @Transactional(rollbackFor = Exception.class)
    public String buildSingleBatch(OmsBizAppBatch omsBizAppBatch) {
        omsBizAppBatch.setBatchCode("TB" + CommonFunctionHelper.getUid());//CUSTOM_CONVENTION
        omsBizAppBatch.setBatchNumber(CommonFunctionHelper.getUid());//AUTO_GENERATE
        omsBizAppBatch.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsBizAppBatch.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        if (omsBizAppBatch != null && omsBizAppBatch.getSubjectLifeCycle() != null && omsBizAppBatch.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsBizAppBatch.setReleaseInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//RELEASED_CURRENT_INDUCTIONID
        }
        if (omsBizAppBatch != null && omsBizAppBatch.getSubjectLifeCycle() != null && omsBizAppBatch.getSubjectLifeCycle().equals("ARCHIVING")) {
            omsBizAppBatch.setArchiveInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//ARCHIVE_CURRENT_INDUCTIONID
        }
        omsBizAppBatch.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsBizAppBatch.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        if (omsBizAppBatch != null && omsBizAppBatch.getSubjectLifeCycle() != null && omsBizAppBatch.getSubjectLifeCycle().equals("CURRENTLY_VALID")) {
            omsBizAppBatch.setReleaseTime(CommonFunctionHelper.getCurrentTime());//RELEASE_SYSTEM_CURRENT_TIME
        }
        if (omsBizAppBatch != null && omsBizAppBatch.getSubjectLifeCycle() != null && omsBizAppBatch.getSubjectLifeCycle().equals("ARCHIVING")) {
            omsBizAppBatch.setArchiveTime(CommonFunctionHelper.getCurrentTime());//HISTORICAL_ARCHIVING
        }
        omsBizAppBatch.setIsValid("FALSE");
        omsBizAppBatch.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsBizAppBatch.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsBizAppBatch)) {
            return omsBizAppBatch.getBatchId();
        } else {
            return "-1";
        }

    }

    /**
     * M-查询单条批次详情[4259]
     * gen by moon at 3/30/2023, 12:39:09 PM
     */
    @Trace(operationName = "M-查询单条批次详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsBizAppBatch querySingleBatchDetail(OmsBizAppBatch omsBizAppBatch) {

        try {

            QueryWrapper<OmsBizAppBatch> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(omsBizAppBatch);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsBizAppBatch> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsBizAppBatch retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3-13-01修改单条批次[4282]
     * gen by moon at 10/15/2022, 10:03:26 PM
     */
    @Trace(operationName = "M3-13-01修改单条批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateSingleBatch(OmsBizAppBatch omsBizAppBatch) {

        return super.updateById(omsBizAppBatch);
    }

    /**
     * 3-13-01重置单条业务应用批次[4389]
     * gen by moon at 10/15/2022, 10:03:27 PM
     */
    @Trace(operationName = "3-13-01重置单条业务应用批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean resetSingleAppBatch(OmsBizAppBatch omsBizAppBatch) {

        return super.updateById(omsBizAppBatch);
    }

    /**
     * 3-13-01查询单条业务应用批次详情[4401]
     * gen by moon at 3/30/2023, 12:39:10 PM
     */
    @Trace(operationName = "3-13-01查询单条业务应用批次详情")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public OmsBizAppBatch querySingleAppBatchDetail(QuerySingleAppBatchDetailReq reqDto) {

        try {

            QueryWrapper<OmsBizAppBatch> queryWrapper = new QueryWrapper<>();
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, new ArrayList<>());
            queryWrapper.orderByDesc("create_time");
            List<OmsBizAppBatch> retList = super.list(queryWrapper);
            if (retList != null && retList.size() > 0) {
                OmsBizAppBatch retData = retList.get(0);

                return retData;
            }
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3-13-01执行业务应用批次循环发牌【循环开始】[4580]
     * gen by moon at 10/15/2022, 10:03:29 PM
     */
    @Trace(operationName = "M3-13-01执行业务应用批次循环发牌【循环开始】")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean implementBizAppBatchdDeal(List<OmsBizAppBatch> omsBizAppBatch) {

        if (omsBizAppBatch == null || omsBizAppBatch.size() == 0) {
            return false;
        }
        return super.saveOrUpdateBatch(omsBizAppBatch);

    }

    /**
     * 3-13-01新增无约定标识业务应用批次[5022]
     * gen by moon at 10/27/2022, 5:11:01 AM
     */
    @Trace(operationName = "3-13-01新增无约定标识业务应用批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public String addNoCodeBizAppBatch(OmsBizAppBatch omsBizAppBatch) {
        omsBizAppBatch.setBatchId(CommonFunctionHelper.getUid());//DISTRIBUTED_ID
        omsBizAppBatch.setBatchNumber(CommonFunctionHelper.getUid());//AUTO_GENERATE
        omsBizAppBatch.setBatchEndTime(CommonFunctionHelper.getFutureTime());//FUTURE_CURRENT_TIME
        omsBizAppBatch.setIsNewbatch("TRUE");
        omsBizAppBatch.setSubjectLifeCycle("EDITING");
        omsBizAppBatch.setIsArchive("FALSE");
        omsBizAppBatch.setIsEditing("TRUE");
        omsBizAppBatch.setOperationInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsBizAppBatch.setCreateInductionId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecInductionRecordId());//CURRENT_INDUCTIONID
        omsBizAppBatch.setOperateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsBizAppBatch.setCreateTime(CommonFunctionHelper.getCurrentTime());//SYSTEM_CURRENT_TIME
        omsBizAppBatch.setIsValid("FALSE");
        omsBizAppBatch.setSpaceId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecSpaceId());//CURRENT_SPACEID
        omsBizAppBatch.setAppId(CommonFunctionHelper.getBaseInfoFromLocal().getSpecAppId());//CURRENT_APPID
        if (super.save(omsBizAppBatch)) {
            return omsBizAppBatch.getBatchId();
        } else {
            return "-1";
        }

    }

    /**
     * M3查询批次测试列表[5120]
     * gen by moon at 11/4/2022, 7:20:41 AM
     */
    @Trace(operationName = "M3查询批次测试列表")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsBizAppBatch> queryBatchTestDataList(QueryBatchTestDataListReq reqDto) {

        try {
            QueryWrapper<OmsBizAppBatch> queryWrapper = new QueryWrapper<>();


            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsBizAppBatch.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsBizAppBatch.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsBizAppBatch.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsBizAppBatch>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }

    /**
     * M3批量删批次测试[5121]
     * gen by moon at 11/4/2022, 7:20:42 AM
     */
    @Trace(operationName = "M3批量删批次测试")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean batchDeleteBatchTestData(List<String> reqDto) {

        if (reqDto == null || reqDto.size() == 0) {
            return false;
        }

        return super.removeByIds(reqDto);
    }

    /**
     * 3-13-01执行批次标识批量查批次[7510]
     * gen by moon at 10/9/2023, 8:49:15 PM
     */
    @Trace(operationName = "3-13-01执行批次标识批量查批次")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    @Transactional(rollbackFor = Exception.class)
    public List<OmsBizAppBatch> implementBatchCodeQueryBatch(ImplementBatchCodeQueryBatchReq reqDto) {

        try {
            QueryWrapper<OmsBizAppBatch> queryWrapper = new QueryWrapper<>();
            reqDto.setIsValid("FALSE");
            if (reqDto.getBizAppBatchList() == null || reqDto.getBizAppBatchList().isEmpty()) {
                return new ArrayList<>();
            }
            queryWrapper.in("batch_code", reqDto.getBizAppBatchList());
            Map<String, Object> fieldInfoMap = null;
            fieldInfoMap = CommonFunctionHelper.objectToMapForLamBda(reqDto);
            List<FieldInfo> compareList = CommonFunctionHelper.getRangeField(OmsBizAppBatch.class);
            CommonFunctionHelper.buildQueryWrapperCompare(queryWrapper, compareList, fieldInfoMap);
            List<FieldInfo> likeList = CommonFunctionHelper.getLikeFiled(OmsBizAppBatch.class);
            CommonFunctionHelper.buildQueryWrapperLike(queryWrapper, likeList, fieldInfoMap);
            likeList.addAll(compareList);
            CommonFunctionHelper.buildQueryWrapperEq(queryWrapper, fieldInfoMap, likeList);
            List<FieldInfo> orderList = CommonFunctionHelper.getOrderList(OmsBizAppBatch.class);
            //CommonFunctionHelper.buildQueryWrapperOrder(queryWrapper, orderList);

            return ((List<OmsBizAppBatch>) super.list(queryWrapper));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BizException("-1", e, false);
        }
    }
}
